package com.lianzheng.dao.impl;

import java.util.List;
import java.util.Map;
import java.util.HashMap;

import com.lianzheng.dao.TbDocVideoaudioinfoDAO;
import com.lianzheng.model.TbDocVideoaudioinfo;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.orm.ObjectRetrievalFailureException;
import org.springframework.stereotype.Repository;


/**
 * This class interacts with Spring's IbatisTemplate to save/delete
 * <p>
 * <a href="TbDocVideoaudioinfo.DAOimpl.java.html"><i>View Source</i></a>
 * </p>
 *
 * @author <a href="mailto:heymanchen@gmail.com">haihua chen</a>
*/
@Repository
public class TbDocVideoaudioinfoDAOimpl extends SqlMapClientDaoSupport implements TbDocVideoaudioinfoDAO {

    /**
     * @see com.lianzheng.dao.TbDocVideoaudioinfoDAO#getTbDocVideoaudioinfo($keytype)
     */

    public TbDocVideoaudioinfo getTbDocVideoaudioinfo(String id){
        return (TbDocVideoaudioinfo)getSqlMapClientTemplate().queryForObject("getTbDocVideoaudioinfo", id);
    }

    public TbDocVideoaudioinfo getTbDocVideoaudioinfoFull(String id){
        return (TbDocVideoaudioinfo)getSqlMapClientTemplate().queryForObject("getTbDocVideoaudioinfoFull", id);
    }

    public void addTbDocVideoaudioinfo(final TbDocVideoaudioinfo tbDocVideoaudioinfo) {
        getSqlMapClientTemplate().update("addTbDocVideoaudioinfo", tbDocVideoaudioinfo);
    }

    public void updateTbDocVideoaudioinfo(final TbDocVideoaudioinfo tbDocVideoaudioinfo) {
    getSqlMapClientTemplate().update("updateTbDocVideoaudioinfo", tbDocVideoaudioinfo);
    }

    public void removeTbDocVideoaudioinfo(String id){
        getSqlMapClientTemplate().update("removeTbDocVideoaudioinfo", id);
    }

    public List getTbDocVideoaudioinfos() {
        return getSqlMapClientTemplate().queryForList("getTbDocVideoaudioinfos",null);
    }

    public List getTbDocVideoaudioinfoByAnd(final TbDocVideoaudioinfo tbDocVideoaudioinfo,String order_by){
        Map map = new HashMap();
        map.put(FIND_BY_AND, "True");
        if (order_by != null)
            map.put(ORDER_BY,order_by);
        tbDocVideoaudioinfo.setMagic(map);
        return getSqlMapClientTemplate().queryForList("getTbDocVideoaudioinfoByMap", tbDocVideoaudioinfo);
    }

    public List getTbDocVideoaudioinfoByOr(final TbDocVideoaudioinfo tbDocVideoaudioinfo,String order_by){
        Map map = new HashMap();
        map.put(FIND_BY_OR, "True");
        if (order_by != null)
            map.put(ORDER_BY,order_by);
        tbDocVideoaudioinfo.setMagic(map);
        return getSqlMapClientTemplate().queryForList("getTbDocVideoaudioinfoByMap", tbDocVideoaudioinfo);
    }
    
    public List getTbDocVideoaudioinfoByLike(final TbDocVideoaudioinfo tbDocVideoaudioinfo,String order_by){
        Map map = new HashMap();
        map.put(FIND_BY_LIKE, "True");
        if (order_by != null)
            map.put(ORDER_BY,order_by);
        tbDocVideoaudioinfo.setMagic(map);
        return getSqlMapClientTemplate().queryForList("getTbDocVideoaudioinfoByMap", tbDocVideoaudioinfo);
    }
}